import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = list(map(int, input().split()))
u, v = 0, 0
for i in a:
if i % 2:
u += 1
else:
v += 1
m = min(u, v)
u, v = u - m, v - m
ans = m + u // 3
print(ans)
/**بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ */
/** المؤلف: محفوظ الرحمن */
#include<bits/stdc++.h>
using namespace std;
/** Loop */
#define lpi(n) for(int i=0;i<n;i++)
#define lpi1(n) for(int i=1;i<n;i++)
#define lpj(m) for(int j=0;j<m;j++)
#define lpr(m) for(int j=m-1;j>=0;j--)
/** Array */
#define ar_mne(v,n) *min_element(v,v+n)
#define ar_mxe(v,n) *max_element(v,v+n)
#define sz(ar) sizeof(ar)/sizeof(ar[0])
#define a_cnt(v,n,a) count(v,v+n,a)
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
int ar[n];
lpi(n) cin>>ar[i];
int one = a_cnt(ar,n,1);
int two = a_cnt(ar,n,2);
int ans = 0;
if(one>two)
{
ans = two + (one - two)/3;
}
else
{
ans = one ;
}
cout<<ans<<endl;
return 0;
}
215B - Olympic Medal | 1445A - Array Rearrangment |
1351A - A+B (Trial Problem) | 935B - Fafa and the Gates |
1291A - Even But Not Even | 1269A - Equation |
441A - Valera and Antique Items | 1702C - Train and Queries |
816B - Karen and Coffee | 838D - Airplane Arrangements |
148B - Escape | 847G - University Classes |
1110A - Parity | 1215B - The Number of Products |
604C - Alternative Thinking | 1204C - Anna Svyatoslav and Maps |
322A - Ciel and Dancing | 1689B - Mystic Permutation |
1711B - Party | 1702D - Not a Cheap String |
1714F - Build a Tree and That Is It | 1703F - Yet Another Problem About Pairs Satisfying an Inequality |
610A - Pasha and Stick | 1200A - Hotelier |
1091A - New Year and the Christmas Ornament | 1352B - Same Parity Summands |
1102A - Integer Sequence Dividing | 630B - Moore's Law |
1004A - Sonya and Hotels | 1680B - Robots |